package be.webchess.www.model;

import java.util.List;
import java.util.Map;

public class ChessBoard {

	private long		id;
	private Room		room;
	private User		whitePlayer;
	private User		blackPlayer;
	private String		nextPlayerColor;
	private long		flags;
	private Map<String, ChessPiece> 	matrix;
	private List<ChessPiece>			pieces;
	private List<ActionHistory> 	historic;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public long getFlags() {
		return flags;
	}
	public String getNextPlayerColor() {
		return nextPlayerColor;
	}
	public void setNextPlayerColor(String nextPlayerColor) {
		this.nextPlayerColor = nextPlayerColor;
	}
	public void setFlags(long flags) {
		this.flags = flags;
	}
	public void setWhitePlayer(User whitePlayer) {
		this.whitePlayer = whitePlayer;
	}
	public User getWhitePlayer() {
		return whitePlayer;
	}
	public void setBlackPlayer(User blackPlayer) {
		this.blackPlayer = blackPlayer;
	}
	public User getBlackPlayer() {
		return blackPlayer;
	}
	public void setRoom(Room room) {
		this.room = room;
	}
	public Room getRoom() {
		return room;
	}
	public void setMatrix(Map<String, ChessPiece> matrix) {
		this.matrix = matrix;
	}
	public Map<String, ChessPiece> getMatrix() {
		return matrix;
	}
	public void setHistoric(List<ActionHistory> historic) {
		this.historic = historic;
	}
	public List<ActionHistory> getHistoric() {
		return historic;
	}
	
	public User			getNextPlayer ()
	{
		if ( nextPlayerColor.compareToIgnoreCase("white") == 0 )
			return this.whitePlayer;
		
		return this.getBlackPlayer();
	}
	public void setPieces(List<ChessPiece> pieces) {
		this.pieces = pieces;
	}
	public List<ChessPiece> getPieces() {
		return pieces;
	}
	
}
